import request from '@/utils/request'
import { getUsername } from '@/api/getUsername'

export function getDSConfig() {
  return request({
    url: '/conf/datasources',
    method: 'get',
    params: { createUser: getUsername() }
  })
}

export function createDSConfig(data) {
  return request({
    url: '/conf/datasources',
    method: 'post',
    data: data,
    params: {
      createUser: getUsername()
    }
  })
}

export function updateDSConfig(data) {
  return request({
    url: '/conf/datasources',
    method: 'put',
    data
  })
}

export function deleteDSConfig(poolName) {
  return request({
    url: '/conf/datasources',
    method: 'delete',
    params: { poolName: poolName, createUser: getUsername() }
  })
}
